package com.mt.mall.entity.good;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.common.system.entity.User;
import com.mt.common.system.entity.Attachment;
import com.mt.mall.entity.merchant.Shop;
import com.mt.mall.entity.good.Specification;
import com.mt.mall.entity.good.Evaluation;
import java.util.List;
@DEntity(label="商品",comment="",moduleLabel="商品")
@Entity(name="mall_commodity")
@Table(name = "mall_commodity" , indexes = { @Index(name = "index_category", columnList = "category"),@Index(name = "index_user_id", columnList = "user_id"),@Index(name = "index_shop_id", columnList = "shop_id")  })
@ApiModel(description = "商品:")
public class Commodity extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="描述信息",comment="描述信息",component="文本",where=true)
	@ApiModelProperty(value = "描述信息:描述信息")
	@Column(name="description",length=255,nullable=false,unique=false)
	private String description;

	@DColumn(index=4,label="商品类别",codeTable="商品类别",codeTableOptions="手机,衣服,家电",comment="商品类别",component="字典下拉单选",where=true)
	@ApiModelProperty(value = "商品类别:商品类别")
	@Column(name="category",length=255,nullable=true,unique=false)
	private String category;

	@DColumn(index=5,label="用户",foreignEntity="User",comment="",component="文本",where=true)
	@ApiModelProperty(value = "用户:")
	@Column(name="user_id",length=255,nullable=true,unique=false)
	private Long userId;

	@Transient
	private User user;

	@Transient
	@ApiModelProperty(value = "用户名称:")
	@DColumn(index=5,label="用户",foreignEntity="User",comment="")
	private String userName;

	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息",component="对象选择",where=true)
	@ApiModelProperty(value = "店铺:店铺信息")
	@Column(name="shop_id",length=255,nullable=false,unique=false)
	private Long shopId;

	@Transient
	private Shop shop;

	@Transient
	@ApiModelProperty(value = "店铺名称:店铺信息")
	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息")
	private String shopName;

	@DColumn(index=7,label="商品编号",comment="商品编号",component="文本",where=true)
	@ApiModelProperty(value = "商品编号:商品编号")
	@Column(name="code_num",length=255,nullable=false,unique=true)
	private String codeNum;


	@DColumn(index=7,label="销售量",comment="销售量",component="文本",where=true)
	@ApiModelProperty(value = "销售量:销售量")
	@Column(name="sale_num",length=255,nullable=false,unique=true)
	private Long saleNum;
	@Transient
	private List<Attachment> attachments;

	@Transient
	private List<Evaluation> evaluations;

	@Transient
	private List<Specification> specifications;

	@Transient
	private Double minPrice;

	public Double getMinPrice() {
		return minPrice;
	}

	public void setMinPrice(Double minPrice) {
		this.minPrice = minPrice;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getCategory() {
		return this.category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getShopId() {
		return this.shopId;
	}

	public Long getSaleNum() {
		return saleNum;
	}

	public void setSaleNum(Long saleNum) {
		this.saleNum = saleNum;
	}

	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	public List<Attachment> getAttachments() {
		return this.attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}

	public List<Evaluation> getEvaluations() {
		return this.evaluations;
	}

	public void setEvaluations(List<Evaluation> evaluations) {
		this.evaluations = evaluations;
	}

	public List<Specification> getSpecifications() {
		return this.specifications;
	}

	public void setSpecifications(List<Specification> specifications) {
		this.specifications = specifications;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		if(user == null){
		}
		else
		{
		this.userId = user.getEid();
		this.user = user;		
		}
}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Shop getShop() {
		return this.shop;
	}

	public void setShop(Shop shop) {
		if(shop == null){
		}
		else
		{
		this.shopId = shop.getEid();
		this.shop = shop;		
		}
}

	public String getShopName() {
		return this.shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public String getCodeNum() {
		return codeNum;
	}

	public void setCodeNum(String codeNum) {
		this.codeNum = codeNum;
	}
}
